<!DOCTYPE html>
<script src="../../resources/run-after-layout-and-paint.js"></script>
<svg>
  <defs>
    <rect id="red" width="100" height="100" fill="red"/>
    <rect id="green" width="100" height="100" fill="green"/>
  </defs>
  <use xlink:href="#red"/>
  <use x="100" xlink:href="#red"/>
</svg>
<script>
runAfterLayoutAndPaint(function() {
  var useElements = document.querySelectorAll('use');
  useElements[0].setAttribute('href', '#green');
  useElements[1].href.baseVal = '#green';
}, true);
</script>
